package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
)

type Article2 struct {
    Title string `json:"Title"`
    Desc string `json:"desc"`
    Content string `json:"content"`
}
type Articles2 []Article2

func returnAllArticles2(w http.ResponseWriter, r *http.Request){
    articles2 := Articles2{
        Article2{Title: "Hello", Desc: "Article Description", Content: "Article Content"},
        Article2{Title: "Hello 2", Desc: "Article Description", Content: "Article Content"},
    }
    fmt.Println("Endpoint Hit: returnAllArticles")
    json.NewEncoder(w).Encode(articles2)
}
func handleRequests2() {
	http.HandleFunc("/all", returnAllArticles2)
    log.Fatal(http.ListenAndServe(":8081", nil))
}

// func main() {
//     handleRequests2()
// }